<template>
  <div class='container'>
    <el-dialog
      title="提示"
      :visible.sync="checkedVisible"
      width="20%"
      :before-close="handleClose"
    >
      <el-radio v-model="form.chkState" :label="1">通过</el-radio>
      <el-radio v-model="form.chkState" :label="2">拒绝</el-radio>
      <el-input
        type="textarea"
        v-model="form.chkRemarks"
        placeholder="请输入审核意见"
        style="margin-top:20px;"
      />
      <span slot="footer" class="dialog-footer">
        <el-button @click="$emit('input',false)">取 消</el-button>
        <el-button type="primary" @click="onConfirm">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions.js'
export default {
  name: 'choice-checked',
  model: {
    prop: 'checkedVisible'
  },
  props: {
    checkedVisible: {
      type: Boolean,
      required: true
    },
    id: {
      type: Number,
      required: true
    }
  },
  data () {
    return {
      form: {
        chkState: 1,
        chkRemarks: ''
      }
    }
  },
  created () {

  },
  methods: {
    // 关闭弹窗
    handleClose () {
      this.$emit('input', false)
    },
    // 确定审核
    async onConfirm () {
      await choiceCheck({
        ...this.form,
        id: this.id
      })
      this.$message.success('审核成功!')
      this.handleClose()
      this.$emit('check-success')
    }
  }

}
</script>

<style scoped lang='less'></style>
